//
//  AlterView.swift
//  CustomAlter
//
//  Created by slience on 2019/7/25.
//  Copyright © 2019 shehuiren. All rights reserved.
//

import UIKit

class AlterView: NIBView {

    @IBOutlet weak var titleLabel : UILabel!
    @IBOutlet weak var contentLabel : UILabel!
    @IBOutlet weak var yesBtn : UIButton!
    @IBOutlet weak var noBtn : UIButton!
    
    var yesAction : (()->Void)?
    var noAction : (()->Void)?
    
    override func setup() {
        super.setup()
        
        backgroundColor = UIColor.black.withAlphaComponent(0.8)
    }
    
    var title : String?{
        
        didSet{
            
            titleLabel.text = title
        }
    }
    
    var content : String?{
        
        didSet{
            
            contentLabel.text = content
        }
    }
    
    var noText:String?{
        
        didSet{
            
            noBtn.setTitle(noText ?? "取消", for: .normal)

        }
    }
    
    var yesText:String?{
        
        didSet{
            
            yesBtn.setTitle(yesText ?? "确定", for: .normal)
        }
    }
    
    @IBAction func yesBtnClick(_ sender:Any){
        
        removeFromSuperview()
        yesAction?()
    }
    
    @IBAction func noBtnClick(_ sender:Any){
        removeFromSuperview()
        noAction?()
    }

}
